Skip to content

Generate the ecosystem catalogs from the docs instead of hardcoding them - #560

Merged
ReneWerner87 merged 4 commits into
masterfrom
claude/homepage-dynamic-display-sf1pe2
Aug 1, 2026
Merged

Generate the ecosystem catalogs from the docs instead of hardcoding them#560
ReneWerner87 merged 4 commits into
masterfrom
claude/homepage-dynamic-display-sf1pe2

Conversation

@ReneWerner87

@ReneWerner87 ReneWerner87 commented Aug 1, 2026

Copy link
Copy Markdown
Member

What does this PR change?

The homepage ecosystem cards listed middleware, storage drivers, template engines and contrib packages from hardcoded arrays with rounded counts (30+ drivers, 20+ packages), so every new package needed a manual edit in src/components/home/Ecosystem.tsx.

scripts/generate-catalogs.js now reads the four catalogs from the docs/ folder and writes src/data/catalogs.json — per package its id, its display name (front matter title, else the first heading) and its doc path. A package is one page directly below a catalog root, the same rule the landscape used before, so nested pages like contrib/socketio/legacy stay part of their package. The middleware catalog is taken from the docs version served at the site root (newest entry of versions.json).

The generated file is not tracked in git. docusaurus.config.ts calls the generator on load, which covers start, build, build:home, build:docs and a bare npx docusaurus call in one place, long before webpack resolves the import — a new script cannot forget it. Only typecheck generates on its own, since tsc never loads the config. The script needs no dependencies, only rewrites the file when its content changed, and is excluded from the spell check (that job installs dependencies, so the file exists there).

Both surfaces read that one file:

  • Homepage (Ecosystem.tsx): exact badge counts and every package of a catalog as chips. The curated item lists and the + many more chip are gone; the file now only carries the wording of a card (icon, title, description, CTA).
  • Ecosystem landscape (fiber-landscape/index.tsx): drops ~55 lines of docs-plugin global data plumbing and URL regexes for the same JSON. Chips now show proper display names (Redis, BasicAuth) instead of raw doc ids, and the hardcoded 30+ Middleware core chip derives its count as well. Middleware links keep the version prefix of the page the reader is on (/next/middleware/… on the Next docs).

The homepage build ships without any docs plugin, which is why the data comes from a generated file rather than the docs plugin global data the landscape used before.

Current numbers: 32 middleware, 34 storage drivers, 9 template engines, 22 contrib packages. Storage includes mockstorage and testhelpers, exactly as the landscape counted them before.

Also switches the storage, template and contrib card links from the /next/ redirects to the canonical URLs.

Verified with a deleted catalogs.json that npm run check (typecheck, matcher tests, both builds) regenerates it and passes, and by rendering the homepage and the ecosystem page from the production build.

claude added 2 commits August 1, 2026 16:48
The homepage ecosystem cards listed middleware, storage drivers, template
engines, and contrib packages from hardcoded arrays with rounded counts
("30+ drivers"), so every new package needed a manual edit.

Add a fiber-catalogs plugin that reads the four catalogs from the synced
docs at build time and publishes them as global data. The homepage now
renders exact counts and the package names from the docs themselves; the
per-card lists keep a featured ordering hint so recognizable packages lead,
while everything else follows alphabetically and the overflow chip shows the
real remainder ("+ 22 more"). Unknown ids in the hint are ignored, so adding
a package requires no homepage change.

The plugin is needed because the homepage build ships without any docs
plugin, so it cannot read the docs plugin global data the ecosystem
landscape uses. That landscape now derives its "30+ Middleware" core chip
from the catalog as well, and the storage/template/contrib card links point
at the canonical URLs instead of the /next/ redirects.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LX25C5g5L5D8AgDtBScJA6
…ges read

Replaces the docusaurus plugin from the previous commit with a plain node
script: scripts/generate-catalogs.mjs reads the docs folder and writes
src/data/catalogs.json (id, display name, and doc path per package). It runs
from the preinstall and pre-build hooks, so every install, dev start, and
build refreshes it, and it needs no dependencies.

Both surfaces now read that one file:

- The homepage ecosystem cards render the exact count and every package of a
  catalog, so the featured lists and the "+ N more" cap are gone. Nothing
  about a package is written by hand anymore, only the card wording.
- The ecosystem landscape drops its docs-plugin lookup (~55 lines of global
  data plumbing and URL regexes) for the same JSON, which also gives its
  chips the proper display names instead of raw doc ids. Middleware links
  keep the version prefix of the page the reader is on.

The generated file is committed so the imports resolve without running the
script first, and is excluded from the spell check.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LX25C5g5L5D8AgDtBScJA6
Copilot AI review requested due to automatic review settings August 1, 2026 17:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces hardcoded ecosystem package lists/counts with a single generated data source derived from the docs/ tree. It centralizes catalog metadata in src/data/catalogs.json so both the homepage ecosystem cards and the ecosystem landscape render accurate package names and counts without manual updates.

Changes:

  • Add a Node-only generator script (scripts/generate-catalogs.mjs) that builds src/data/catalogs.json from the docs directories (and versioned middleware docs).
  • Update the homepage ecosystem cards (Ecosystem.tsx) to render counts and chips from catalogs.json, removing curated lists and “+ many more”.
  • Update the ecosystem landscape (fiber-landscape/index.tsx) to use the generated catalogs and keep version-prefixed middleware links; wire generation into npm lifecycle hooks and exclude the generated JSON from spellcheck.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/types/catalogs.ts Adds TypeScript types for the generated catalogs JSON shape.
src/data/catalogs.json Adds the generated, committed catalog data consumed by UI components.
src/components/home/Ecosystem.tsx Switches homepage ecosystem cards to render counts/chips from generated catalogs.
src/components/home/Ecosystem.module.scss Removes styling for the deleted “+ many more” chip variant.
src/components/fiber-landscape/index.tsx Replaces docs-plugin global-data catalog plumbing with the generated catalogs JSON and version-aware middleware linking.
scripts/generate-catalogs.mjs New generator that reads docs directories/front matter/headings and writes src/data/catalogs.json only when changed.
package.json Runs catalog generation during install/start/build flows via pre* hooks and a dedicated script.
.cspell.json Ignores the generated src/data/catalogs.json file for spellchecking.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds a catalog generator that discovers package documentation and writes typed catalog data. The ecosystem cards and fiber landscape consume this data for package labels, counts, and version-aware links.

Changes

Catalog integration

Layer / File(s) Summary
Catalog generation and data contract
src/types/catalogs.ts, scripts/generate-catalogs.mjs, .gitignore
The generator discovers package documentation, extracts labels, sorts entries, validates catalogs, and writes src/data/catalogs.json only when content changes. TypeScript types define the generated structure, and Git ignores the generated file.
Ecosystem catalog rendering
src/components/home/Ecosystem.tsx, src/components/home/Ecosystem.module.scss
Ecosystem cards use generated catalog keys, labels, nouns, and exact counts. Static item lists, “many more” labels, and the .chipMore style were removed.
Fiber landscape catalog links
src/components/fiber-landscape/index.tsx
The fiber landscape uses generated catalogs, displays current catalog counts, and resolves middleware links with the active documentation version.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Documentation
  participant generate_catalogs.mjs
  participant catalogs.json
  participant Ecosystem
  participant FiberLandscape
  Documentation->>generate_catalogs.mjs: provide package documents and version metadata
  generate_catalogs.mjs->>catalogs.json: generate sorted catalog data
  catalogs.json->>Ecosystem: provide entries and counts
  catalogs.json->>FiberLandscape: provide entries and counts
  FiberLandscape->>FiberLandscape: resolve version-aware catalog links
Loading

Poem

A rabbit hops through docs so bright,
And sorts each package left to right.
Catalogs bloom in JSON rows,
Counts appear where each card goes.
Versioned paths guide every leap,
While carrots rest beside the heap.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: generating ecosystem catalogs from documentation instead of hardcoded data.
Description check ✅ Passed The description uses the required section and provides detailed scope, implementation, behavior, counts, links, and verification results.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/homepage-dynamic-display-sf1pe2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

claude added 2 commits August 1, 2026 17:35
The file is derived from the docs folder, so tracking it only produces diff
noise and can go stale against the docs it mirrors. It is now gitignored and
written on the fly instead: the generator already ran from preinstall and
the pre-build hooks, and typecheck gets one too so tsc can resolve the JSON
import in a fresh checkout.

Regenerating from scratch was verified for npm ci, npm install, typecheck,
build:home and build:docs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LX25C5g5L5D8AgDtBScJA6
…ooks

npm matches pre* hooks on the exact script name, so covering the builds took
one hook per entry point (prebuild, prebuild:home, prebuild:docs) plus
prestart and preinstall. Loading the generator from docusaurus.config.ts
replaces all of them: the config is read at the start of every docusaurus
command and long before webpack resolves the JSON import, so start, build,
build:home, build:docs and a bare npx docusaurus call are all covered by one
call that cannot be forgotten when a script is added.

The script becomes a CommonJS module exporting generateCatalogs() and keeps
working as a CLI. Only typecheck still generates on its own, because tsc
never loads the config and would not resolve the import in a fresh checkout.

Verified from a deleted catalogs.json: npm run check (typecheck, tests, both
builds) regenerates it and passes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LX25C5g5L5D8AgDtBScJA6
@ReneWerner87
ReneWerner87 merged commit 0a0e4ad into master Aug 1, 2026
10 checks passed
@ReneWerner87
ReneWerner87 deleted the claude/homepage-dynamic-display-sf1pe2 branch August 1, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants